﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading;
using System.IO;

namespace SpectrumToWaveLength
{
    class Program
    {
        static void Main(string[] args)
        {
            Console.WriteLine("数据分析中……!");
            AnalysizingFiles();
            Console.ReadKey();
            
        }

        private static void AnalysizingFiles()
        {
            string strDir = "D://";
            AnalysingFile af = new AnalysingFile();
            DirectoryInfo dir = new DirectoryInfo(strDir);
            FileInfo[] fis = dir.GetFiles();
            foreach(FileInfo fi in fis)
            {
                if (!fi.Name.Contains(".dat"))
                {
                    continue;
                }
                DateTime dt = DateTime.Now;
                try
                {
                    dt = DateTime.ParseExact(fi.Name.Replace(".dat", ""), "yyyyMMddHHmmss", null);
                }
                catch
                {
                    continue;
                }
                if (dt > DateTime.Now.AddHours(-1))
                {
                    continue;
                }
                ThreadPool.QueueUserWorkItem(new WaitCallback(af.ProcessFile),fi);
            }
        }
    }
}
